<template>
	<view>
		<uni-nav-bar :fixed="true" left-icon="back" title="团队收益" @clickLeft="leftBack" background-color="#318cff" color="#fff"></uni-nav-bar>
		
		<view class="dfj-pd-30">
			<block v-for="(item,index) in list">
				<view class="dfj-bg-white dfj-mg-b-20">
					<view class="dfj-flex dfj-flex-ai-c dfj-pd-tb-20 dfj-t-c dfj-t-333">
						<view class="dfj-flex-1">{{ item.createDate | timestampToTime }}</view>
						<view class="dfj-flex-1">{{ item.tyle == 1?'直推':'间推' }}</view>
						<view class="dfj-flex-1">{{ item.integral }}</view>
						<!-- <view class="dfj-flex-1">查看详情<text class="dfj-icon icon-shangjiantou"></text></view> -->
					</view>
					<view class="dfj-bg-e1e dfj-flex dfj-flex-ai-c dfj-pd-30 dfj-t-666">
						<view class="dfj-flex-1">
							您推荐的用户刚刚消费了￥{{ item.costPrice }}
						</view>
						<view>
							<image style="width: 100rpx;height: auto;border-radius: 100%;" :src="item.subUserIconUrl"></image>
							<view>{{ item.subUserName }}</view>
						</view>
					</view>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				list: []
			}
		},
		filters: {
			timestampToTime(timestamp) {
				var date = new Date(timestamp); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
				var Y = date.getFullYear() + '-';
				var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
				var D = date.getDate() + ' ';
				var h = date.getHours() + ':';
				var m = date.getMinutes() + ':';
				var s = date.getSeconds();
				return Y + M + D + h + m + s;
			}
		},
		onLoad() {
			this.getList();
		},
		methods: {
			leftBack() {
				uni.navigateBack();
			},
			getList() {
				this.$http({
					url: '/order/getUserTeamReward',
					method: 'GET',
					data: {
						page: this.page,
						row: 15
					}
				}).then(res=> {
					if(res.data.list.length>0){
						this.page++
						this.list.push(...res.data.list)
					}
				})
			}
		},
		onReachBottom() {
			this.getList();
		}
	}
</script>

<style>
</style>
